# Contributor: Kay Thomas <kaythomas@pm.me>
# Maintainer: Kay Thomas <kaythomas@pm.me>
pkgname=fileshelter
pkgver=6.2.0
pkgrel=1
pkgdesc="One-click file sharing web application"
url="https://github.com/epoupon/fileshelter"
arch="all"
license="GPL-3.0-or-later"
makedepends="cmake boost-dev libarchive-dev libconfig-dev wt-dev samurai"
subpackages="$pkgname-openrc"
pkgusers="fileshelter"
pkggroups="fileshelter"
install="$pkgname.pre-install"
source="$pkgname-$pkgver.tar.gz::https://github.com/epoupon/fileshelter/archive/v$pkgver.tar.gz
	std-optional.patch
	std-algorithm.patch
	fileshelter.initd
	"
options="!check" # No testsuite

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_INSTALL_PREFIX=/usr
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build

	install -dm755 -o fileshelter -g fileshelter \
		"$pkgdir"/var/fileshelter

	install -Dm644 conf/fileshelter.conf \
		"$pkgdir"/etc/fileshelter.conf

	rm "$pkgdir"/usr/share/fileshelter/default.service

	install -Dm755 "$srcdir"/$pkgname.initd \
		"$pkgdir"/etc/init.d/$pkgname
}

sha512sums="
5563fd04a1c97064f443d7081e897e3473d5937d43410d48d32dbb610c90d0eb8df2fb0b642aaf7af9c5fdad30f53d7f3a797021121fc9a3dbd35b2e64fdae6c  fileshelter-6.2.0.tar.gz
a1ef635d1f7ee82abc4abf5d1d0253515308923e7443e86faa34be14af1056714c204da5d9a2a3162595ad9395e66f2452df87487dce0f1e97d460c794d9dbbc  std-optional.patch
b14c04d427039fb6035aacca006c00956b8394f488427576aa333348fe54837dd9da56ab10b5484a66a0d85302b94a1fd09d48b4d84718e1a88daf04d706b5b0  std-algorithm.patch
56051559c91d5c269f8e945445aab3e48de7f3593b7321e6556aee87c458091cfaf14a220a0a8bbb5aa8f682fe1ebd289cfb8dd21b0f3eeb881268f28d84c115  fileshelter.initd
"
